package cn.sc.allinpay.allfavour.business.common.data;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

public class SpOrderInfo implements Parcelable {

    protected SpOrderInfo(Parcel in) {
        cancelFlag = in.readInt();
        amount = in.readString();
        createTime = in.readString();
        lastUpdateTime = in.readString();
        orderAmount = in.readString();
        usdkPayFinTime = in.readString();
        orderCode = in.readString();
        outOrderNo = in.readString();
        if (in.readByte() == 0) {
            orderStatus = null;
        } else {
            orderStatus = in.readLong();
        }
        if (in.readByte() == 0) {
            refundStatus = null;
        } else {
            refundStatus = in.readLong();
        }
        if (in.readByte() == 0) {
            rmaId = null;
        } else {
            rmaId = in.readLong();
        }
        orderId = in.readString();
        refundTime = in.readString();
        orderPayment = in.readArrayList(OrderPaymentInfo.class.getClassLoader());
    }

    public SpOrderInfo() {

    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(cancelFlag);
        dest.writeString(amount);
        dest.writeString(createTime);
        dest.writeString(lastUpdateTime);
        dest.writeString(orderAmount);
        dest.writeString(usdkPayFinTime);
        dest.writeString(orderCode);
        dest.writeString(outOrderNo);
        if (orderStatus == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(orderStatus);
        }
        if (refundStatus == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(refundStatus);
        }
        if (rmaId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(rmaId);
        }
        dest.writeString(orderId);
        dest.writeString(refundTime);

        dest.writeList(orderPayment);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<SpOrderInfo> CREATOR = new Creator<SpOrderInfo>() {
        @Override
        public SpOrderInfo createFromParcel(Parcel in) {
            return new SpOrderInfo(in);
        }

        @Override
        public SpOrderInfo[] newArray(int size) {
            return new SpOrderInfo[size];
        }
    };

    public int getCancelFlag() {
        return cancelFlag;
    }

    public void setCancelFlag(int cancelFlag) {
        this.cancelFlag = cancelFlag;
    }

    public String getAmount() {
        return amount;
    }

    public void setAmount(String amount) {
        this.amount = amount;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(String lastUpdateTime) {
        this.lastUpdateTime = lastUpdateTime;
    }

    public String getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(String orderAmount) {
        this.orderAmount = orderAmount;
    }

    public String getUsdkPayFinTime() {
        return usdkPayFinTime;
    }

    public void setUsdkPayFinTime(String usdkPayFinTime) {
        this.usdkPayFinTime = usdkPayFinTime;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public String getOutOrderNo() {
        return outOrderNo;
    }

    public void setOutOrderNo(String outOrderNo) {
        this.outOrderNo = outOrderNo;
    }

    public List<OrderPaymentInfo> getOrderPayment() {
        return orderPayment;
    }

    public void setOrderPayment(List<OrderPaymentInfo> orderPayment) {
        this.orderPayment = orderPayment;
    }

    public Long getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Long orderStatus) {
        this.orderStatus = orderStatus;
    }

    public Long getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(Long refundStatus) {
        this.refundStatus = refundStatus;
    }

    public Long getRmaId() {
        return rmaId;
    }

    public void setRmaId(Long rmaId) {
        this.rmaId = rmaId;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getRefundTime() {
        return refundTime;
    }

    public void setRefundTime(String refundTime) {
        this.refundTime = refundTime;
    }

    private int cancelFlag;
    private String amount; // 订单金额
    private String createTime;
    private String lastUpdateTime;
    private String orderAmount; // 支付金额
    private String usdkPayFinTime;
    private String orderCode;
    private String outOrderNo;
    private List<OrderPaymentInfo> orderPayment;
    private Long orderStatus;
    private Long refundStatus;
    private Long rmaId;
    private String orderId;
    private String refundTime;
}

